/*
 * Copyright 2022 Palantir Technologies, Inc. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/* eslint-disable sort-keys */

import { lookupTimezoneOffset } from "./timezoneOffsetUtils";
import type { Timezone, TimezoneWithoutOffset } from "./timezoneTypes";

const utcWithoutOffset: TimezoneWithoutOffset = { label: "UTC", ianaCode: "Etc/UTC" };

export const UTC_TIME: Timezone = lookupTimezoneOffset(utcWithoutOffset);

const timezonesWithoutOffset: TimezoneWithoutOffset[] = [
    utcWithoutOffset,
    { label: "Niue", ianaCode: "Pacific/Niue" },
    { label: "Pago Pago", ianaCode: "Pacific/Pago_Pago" },
    { label: "Hawaii Time", ianaCode: "Pacific/Honolulu" },
    { label: "Rarotonga", ianaCode: "Pacific/Rarotonga" },
    { label: "Tahiti", ianaCode: "Pacific/Tahiti" },
    { label: "Marquesas", ianaCode: "Pacific/Marquesas" },
    { label: "Alaska", ianaCode: "America/Anchorage" },
    { label: "Gambier", ianaCode: "Pacific/Gambier" },
    { label: "Los Angeles", ianaCode: "America/Los_Angeles" },
    { label: "Tijuana", ianaCode: "America/Tijuana" },
    { label: "Vancouver", ianaCode: "America/Vancouver" },
    { label: "Whitehorse", ianaCode: "America/Whitehorse" },
    { label: "Pitcairn", ianaCode: "Pacific/Pitcairn" },
    { label: "Denver", ianaCode: "America/Denver" },
    { label: "Arizona", ianaCode: "America/Phoenix" },
    { label: "Chihuahua, Mazatlan", ianaCode: "America/Mazatlan" },
    { label: "Dawson Creek", ianaCode: "America/Dawson_Creek" },
    { label: "Edmonton", ianaCode: "America/Edmonton" },
    { label: "Hermosillo", ianaCode: "America/Hermosillo" },
    { label: "Yellowknife", ianaCode: "America/Yellowknife" },
    { label: "Belize", ianaCode: "America/Belize" },
    { label: "Chicago", ianaCode: "America/Chicago" },
    { label: "Mexico City", ianaCode: "America/Mexico_City" },
    { label: "Regina", ianaCode: "America/Regina" },
    { label: "Tegucigalpa", ianaCode: "America/Tegucigalpa" },
    { label: "Winnipeg", ianaCode: "America/Winnipeg" },
    { label: "Costa Rica", ianaCode: "America/Costa_Rica" },
    { label: "El Salvador", ianaCode: "America/El_Salvador" },
    { label: "Galapagos", ianaCode: "Pacific/Galapagos" },
    { label: "Guatemala", ianaCode: "America/Guatemala" },
    { label: "Managua", ianaCode: "America/Managua" },
    { label: "America Cancun", ianaCode: "America/Cancun" },
    { label: "Bogota", ianaCode: "America/Bogota" },
    { label: "Easter Island", ianaCode: "Pacific/Easter" },
    { label: "New York", ianaCode: "America/New_York" },
    { label: "Iqaluit", ianaCode: "America/Iqaluit" },
    { label: "Toronto", ianaCode: "America/Toronto" },
    { label: "Guayaquil", ianaCode: "America/Guayaquil" },
    { label: "Havana", ianaCode: "America/Havana" },
    { label: "Jamaica", ianaCode: "America/Jamaica" },
    { label: "Lima", ianaCode: "America/Lima" },
    { label: "Nassau", ianaCode: "America/Nassau" },
    { label: "Panama", ianaCode: "America/Panama" },
    { label: "Port-au-Prince", ianaCode: "America/Port-au-Prince" },
    { label: "Rio Branco", ianaCode: "America/Rio_Branco" },
    { label: "Halifax", ianaCode: "America/Halifax" },
    { label: "Barbados", ianaCode: "America/Barbados" },
    { label: "Bermuda", ianaCode: "Atlantic/Bermuda" },
    { label: "Boa Vista", ianaCode: "America/Boa_Vista" },
    { label: "Caracas", ianaCode: "America/Caracas" },
    { label: "Curacao", ianaCode: "America/Curacao" },
    { label: "Grand Turk", ianaCode: "America/Grand_Turk" },
    { label: "Guyana", ianaCode: "America/Guyana" },
    { label: "La Paz", ianaCode: "America/La_Paz" },
    { label: "Manaus", ianaCode: "America/Manaus" },
    { label: "Martinique", ianaCode: "America/Martinique" },
    { label: "Port of Spain", ianaCode: "America/Port_of_Spain" },
    { label: "Porto Velho", ianaCode: "America/Porto_Velho" },
    { label: "Puerto Rico", ianaCode: "America/Puerto_Rico" },
    { label: "Santo Domingo", ianaCode: "America/Santo_Domingo" },
    { label: "Thule", ianaCode: "America/Thule" },
    { label: "St. Johns", ianaCode: "America/St_Johns" },
    { label: "Araguaina", ianaCode: "America/Araguaina" },
    { label: "Asuncion", ianaCode: "America/Asuncion" },
    { label: "Belem", ianaCode: "America/Belem" },
    { label: "Buenos Aires", ianaCode: "America/Argentina/Buenos_Aires" },
    { label: "Campo Grande", ianaCode: "America/Campo_Grande" },
    { label: "Cayenne", ianaCode: "America/Cayenne" },
    { label: "Cuiaba", ianaCode: "America/Cuiaba" },
    { label: "Fortaleza", ianaCode: "America/Fortaleza" },
    { label: "Godthab", ianaCode: "America/Godthab" },
    { label: "Maceio", ianaCode: "America/Maceio" },
    { label: "Miquelon", ianaCode: "America/Miquelon" },
    { label: "Montevideo", ianaCode: "America/Montevideo" },
    { label: "Palmer", ianaCode: "Antarctica/Palmer" },
    { label: "Paramaribo", ianaCode: "America/Paramaribo" },
    { label: "Punta Arenas", ianaCode: "America/Punta_Arenas" },
    { label: "Recife", ianaCode: "America/Recife" },
    { label: "Rothera", ianaCode: "Antarctica/Rothera" },
    { label: "Salvador", ianaCode: "America/Bahia" },
    { label: "Santiago", ianaCode: "America/Santiago" },
    { label: "Stanley", ianaCode: "Atlantic/Stanley" },
    { label: "Noronha", ianaCode: "America/Noronha" },
    { label: "Sao Paulo", ianaCode: "America/Sao_Paulo" },
    { label: "South Georgia", ianaCode: "Atlantic/South_Georgia" },
    { label: "Azores", ianaCode: "Atlantic/Azores" },
    { label: "Cape Verde", ianaCode: "Atlantic/Cape_Verde" },
    { label: "Scoresbysund", ianaCode: "America/Scoresbysund" },
    { label: "Abidjan", ianaCode: "Africa/Abidjan" },
    { label: "Accra", ianaCode: "Africa/Accra" },
    { label: "Bissau", ianaCode: "Africa/Bissau" },
    { label: "Canary Islands", ianaCode: "Atlantic/Canary" },
    { label: "Casablanca", ianaCode: "Africa/Casablanca" },
    { label: "Danmarkshavn", ianaCode: "America/Danmarkshavn" },
    { label: "Dublin", ianaCode: "Europe/Dublin" },
    { label: "El Aaiun", ianaCode: "Africa/El_Aaiun" },
    { label: "Faeroe", ianaCode: "Atlantic/Faroe" },
    { label: "GMT (no daylight saving)", ianaCode: "Etc/GMT" },
    { label: "Lisbon", ianaCode: "Europe/Lisbon" },
    { label: "London", ianaCode: "Europe/London" },
    { label: "Monrovia", ianaCode: "Africa/Monrovia" },
    { label: "Reykjavik", ianaCode: "Atlantic/Reykjavik" },
    { label: "Algiers", ianaCode: "Africa/Algiers" },
    { label: "Amsterdam", ianaCode: "Europe/Amsterdam" },
    { label: "Andorra", ianaCode: "Europe/Andorra" },
    { label: "Berlin", ianaCode: "Europe/Berlin" },
    { label: "Brussels", ianaCode: "Europe/Brussels" },
    { label: "Budapest", ianaCode: "Europe/Budapest" },
    { label: "Belgrade", ianaCode: "Europe/Belgrade" },
    { label: "Prague", ianaCode: "Europe/Prague" },
    { label: "Ceuta", ianaCode: "Africa/Ceuta" },
    { label: "Copenhagen", ianaCode: "Europe/Copenhagen" },
    { label: "Gibraltar", ianaCode: "Europe/Gibraltar" },
    { label: "Lagos", ianaCode: "Africa/Lagos" },
    { label: "Luxembourg", ianaCode: "Europe/Luxembourg" },
    { label: "Madrid", ianaCode: "Europe/Madrid" },
    { label: "Malta", ianaCode: "Europe/Malta" },
    { label: "Monaco", ianaCode: "Europe/Monaco" },
    { label: "Ndjamena", ianaCode: "Africa/Ndjamena" },
    { label: "Oslo", ianaCode: "Europe/Oslo" },
    { label: "Paris", ianaCode: "Europe/Paris" },
    { label: "Rome", ianaCode: "Europe/Rome" },
    { label: "Stockholm", ianaCode: "Europe/Stockholm" },
    { label: "Tirane", ianaCode: "Europe/Tirane" },
    { label: "Tunis", ianaCode: "Africa/Tunis" },
    { label: "Vienna", ianaCode: "Europe/Vienna" },
    { label: "Warsaw", ianaCode: "Europe/Warsaw" },
    { label: "Zurich", ianaCode: "Europe/Zurich" },
    { label: "Amman", ianaCode: "Asia/Amman" },
    { label: "Athens", ianaCode: "Europe/Athens" },
    { label: "Beirut", ianaCode: "Asia/Beirut" },
    { label: "Bucharest", ianaCode: "Europe/Bucharest" },
    { label: "Cairo", ianaCode: "Africa/Cairo" },
    { label: "Chisinau", ianaCode: "Europe/Chisinau" },
    { label: "Damascus", ianaCode: "Asia/Damascus" },
    { label: "Gaza", ianaCode: "Asia/Gaza" },
    { label: "Helsinki", ianaCode: "Europe/Helsinki" },
    { label: "Jerusalem", ianaCode: "Asia/Jerusalem" },
    { label: "Johannesburg", ianaCode: "Africa/Johannesburg" },
    { label: "Khartoum", ianaCode: "Africa/Khartoum" },
    { label: "Kyiv", ianaCode: "Europe/Kiev" },
    { label: "Maputo", ianaCode: "Africa/Maputo" },
    { label: "Kaliningrad", ianaCode: "Europe/Kaliningrad" },
    { label: "Nicosia", ianaCode: "Asia/Nicosia" },
    { label: "Riga", ianaCode: "Europe/Riga" },
    { label: "Sofia", ianaCode: "Europe/Sofia" },
    { label: "Tallinn", ianaCode: "Europe/Tallinn" },
    { label: "Tripoli", ianaCode: "Africa/Tripoli" },
    { label: "Vilnius", ianaCode: "Europe/Vilnius" },
    { label: "Windhoek", ianaCode: "Africa/Windhoek" },
    { label: "Baghdad", ianaCode: "Asia/Baghdad" },
    { label: "Istanbul", ianaCode: "Europe/Istanbul" },
    { label: "Minsk", ianaCode: "Europe/Minsk" },
    { label: "Moscow", ianaCode: "Europe/Moscow" },
    { label: "Nairobi", ianaCode: "Africa/Nairobi" },
    { label: "Qatar", ianaCode: "Asia/Qatar" },
    { label: "Riyadh", ianaCode: "Asia/Riyadh" },
    { label: "Syowa", ianaCode: "Antarctica/Syowa" },
    { label: "Tehran", ianaCode: "Asia/Tehran" },
    { label: "Baku", ianaCode: "Asia/Baku" },
    { label: "Dubai", ianaCode: "Asia/Dubai" },
    { label: "Mahe", ianaCode: "Indian/Mahe" },
    { label: "Mauritius", ianaCode: "Indian/Mauritius" },
    { label: "Samara", ianaCode: "Europe/Samara" },
    { label: "Reunion", ianaCode: "Indian/Reunion" },
    { label: "Tbilisi", ianaCode: "Asia/Tbilisi" },
    { label: "Yerevan", ianaCode: "Asia/Yerevan" },
    { label: "Kabul", ianaCode: "Asia/Kabul" },
    { label: "Aqtau", ianaCode: "Asia/Aqtau" },
    { label: "Aqtobe", ianaCode: "Asia/Aqtobe" },
    { label: "Ashgabat", ianaCode: "Asia/Ashgabat" },
    { label: "Dushanbe", ianaCode: "Asia/Dushanbe" },
    { label: "Karachi", ianaCode: "Asia/Karachi" },
    { label: "Kerguelen", ianaCode: "Indian/Kerguelen" },
    { label: "Maldives", ianaCode: "Indian/Maldives" },
    { label: "Mawson", ianaCode: "Antarctica/Mawson" },
    { label: "Yekaterinburg", ianaCode: "Asia/Yekaterinburg" },
    { label: "Tashkent", ianaCode: "Asia/Tashkent" },
    { label: "Colombo", ianaCode: "Asia/Colombo" },
    { label: "India - Kolkata", ianaCode: "Asia/Kolkata" },
    { label: "Kathmandu", ianaCode: "Asia/Kathmandu" },
    { label: "Almaty", ianaCode: "Asia/Almaty" },
    { label: "Bishkek", ianaCode: "Asia/Bishkek" },
    { label: "Chagos", ianaCode: "Indian/Chagos" },
    { label: "Dhaka", ianaCode: "Asia/Dhaka" },
    { label: "Omsk", ianaCode: "Asia/Omsk" },
    { label: "Thimphu", ianaCode: "Asia/Thimphu" },
    { label: "Vostok", ianaCode: "Antarctica/Vostok" },
    { label: "Cocos", ianaCode: "Indian/Cocos" },
    { label: "Rangoon", ianaCode: "Asia/Yangon" },
    { label: "Bangkok", ianaCode: "Asia/Bangkok" },
    { label: "Christmas", ianaCode: "Indian/Christmas" },
    { label: "Davis", ianaCode: "Antarctica/Davis" },
    { label: "Hanoi", ianaCode: "Asia/Saigon" },
    { label: "Hovd", ianaCode: "Asia/Hovd" },
    { label: "Jakarta", ianaCode: "Asia/Jakarta" },
    { label: "Moscow+04 - Krasnoyarsk", ianaCode: "Asia/Krasnoyarsk" },
    { label: "Brunei", ianaCode: "Asia/Brunei" },
    { label: "China - Beijing", ianaCode: "Asia/Shanghai" },
    { label: "Choibalsan", ianaCode: "Asia/Choibalsan" },
    { label: "Hong Kong", ianaCode: "Asia/Hong_Kong" },
    { label: "Kuala Lumpur", ianaCode: "Asia/Kuala_Lumpur" },
    { label: "Macau", ianaCode: "Asia/Macau" },
    { label: "Makassar", ianaCode: "Asia/Makassar" },
    { label: "Manila", ianaCode: "Asia/Manila" },
    { label: "Moscow+05 - Irkutsk", ianaCode: "Asia/Irkutsk" },
    { label: "Singapore", ianaCode: "Asia/Singapore" },
    { label: "Taipei", ianaCode: "Asia/Taipei" },
    { label: "Ulaanbaatar", ianaCode: "Asia/Ulaanbaatar" },
    { label: "Perth", ianaCode: "Australia/Perth" },
    { label: "Pyongyang", ianaCode: "Asia/Pyongyang" },
    { label: "Dili", ianaCode: "Asia/Dili" },
    { label: "Jayapura", ianaCode: "Asia/Jayapura" },
    { label: "Moscow+06 - Yakutsk", ianaCode: "Asia/Yakutsk" },
    { label: "Palau", ianaCode: "Pacific/Palau" },
    { label: "Seoul", ianaCode: "Asia/Seoul" },
    { label: "Tokyo", ianaCode: "Asia/Tokyo" },
    { label: "Darwin", ianaCode: "Australia/Darwin" },
    { label: "Dumont D'Urville", ianaCode: "Antarctica/DumontDUrville" },
    { label: "Brisbane", ianaCode: "Australia/Brisbane" },
    { label: "Guam", ianaCode: "Pacific/Guam" },
    { label: "Moscow+07 - Vladivostok", ianaCode: "Asia/Vladivostok" },
    { label: "Port Moresby", ianaCode: "Pacific/Port_Moresby" },
    { label: "Truk", ianaCode: "Pacific/Chuuk" },
    { label: "Adelaide", ianaCode: "Australia/Adelaide" },
    { label: "Casey", ianaCode: "Antarctica/Casey" },
    { label: "Hobart", ianaCode: "Australia/Hobart" },
    { label: "Melbourne, Sydney", ianaCode: "Australia/Sydney" },
    { label: "Efate", ianaCode: "Pacific/Efate" },
    { label: "Guadalcanal", ianaCode: "Pacific/Guadalcanal" },
    { label: "Kosrae", ianaCode: "Pacific/Kosrae" },
    { label: "Moscow+08 - Magadan", ianaCode: "Asia/Magadan" },
    { label: "Norfolk", ianaCode: "Pacific/Norfolk" },
    { label: "Noumea", ianaCode: "Pacific/Noumea" },
    { label: "Ponape", ianaCode: "Pacific/Pohnpei" },
    { label: "Funafuti", ianaCode: "Pacific/Funafuti" },
    { label: "Kwajalein", ianaCode: "Pacific/Kwajalein" },
    { label: "Majuro", ianaCode: "Pacific/Majuro" },
    { label: "Moscow+09 - Petropavlovsk-Kamchatskiy", ianaCode: "Asia/Kamchatka" },
    { label: "Nauru", ianaCode: "Pacific/Nauru" },
    { label: "Tarawa", ianaCode: "Pacific/Tarawa" },
    { label: "Wake", ianaCode: "Pacific/Wake" },
    { label: "Wallis", ianaCode: "Pacific/Wallis" },
    { label: "Auckland", ianaCode: "Pacific/Auckland" },
    { label: "Enderbury", ianaCode: "Pacific/Enderbury" },
    { label: "Fakaofo", ianaCode: "Pacific/Fakaofo" },
    { label: "Fiji", ianaCode: "Pacific/Fiji" },
    { label: "Tongatapu", ianaCode: "Pacific/Tongatapu" },
    { label: "Apia", ianaCode: "Pacific/Apia" },
    { label: "Kiritimati", ianaCode: "Pacific/Kiritimati" },
];

const minimalTimezonesWithoutOffset: TimezoneWithoutOffset[] = [
    utcWithoutOffset,
    { label: "Pago Pago", ianaCode: "Pacific/Pago_Pago" },
    { label: "Hawaii Time", ianaCode: "Pacific/Honolulu" },
    { label: "Marquesas", ianaCode: "Pacific/Marquesas" },
    { label: "Alaska", ianaCode: "America/Anchorage" },
    { label: "Los Angeles", ianaCode: "America/Los_Angeles" },
    { label: "Denver", ianaCode: "America/Denver" },
    { label: "Mexico City", ianaCode: "America/Mexico_City" },
    { label: "New York", ianaCode: "America/New_York" },
    { label: "Puerto Rico", ianaCode: "America/Puerto_Rico" },
    { label: "St. Johns", ianaCode: "America/St_Johns" },
    { label: "Buenos Aires", ianaCode: "America/Argentina/Buenos_Aires" },
    { label: "Sao Paulo", ianaCode: "America/Sao_Paulo" },
    { label: "Cape Verde", ianaCode: "Atlantic/Cape_Verde" },
    { label: "Paris", ianaCode: "Europe/Paris" },
    { label: "Cairo", ianaCode: "Africa/Cairo" },
    { label: "Moscow", ianaCode: "Europe/Moscow" },
    { label: "Tehran", ianaCode: "Asia/Tehran" },
    { label: "Dubai", ianaCode: "Asia/Dubai" },
    { label: "Karachi", ianaCode: "Asia/Karachi" },
    { label: "India - Kolkata", ianaCode: "Asia/Kolkata" },
    { label: "Kathmandu", ianaCode: "Asia/Kathmandu" },
    { label: "Dhaka", ianaCode: "Asia/Dhaka" },
    { label: "Rangoon", ianaCode: "Asia/Yangon" },
    { label: "Jakarta", ianaCode: "Asia/Jakarta" },
    { label: "Manila", ianaCode: "Asia/Manila" },
    { label: "Tokyo", ianaCode: "Asia/Tokyo" },
    { label: "Brisbane", ianaCode: "Australia/Brisbane" },
    { label: "Adelaide", ianaCode: "Australia/Adelaide" },
    { label: "Melbourne, Sydney", ianaCode: "Australia/Sydney" },
    { label: "Nauru", ianaCode: "Pacific/Nauru" },
    { label: "Auckland", ianaCode: "Pacific/Auckland" },
    { label: "Kiritimati", ianaCode: "Pacific/Kiritimati" },
];

/** List of standard timezones */
export const TIMEZONE_ITEMS = timezonesWithoutOffset.map(tz => lookupTimezoneOffset(tz));

/** Minimal list of timezones */
export const MINIMAL_TIMEZONE_ITEMS = minimalTimezonesWithoutOffset.map(tz => lookupTimezoneOffset(tz));
